using System;
using System.ComponentModel;
using System.Data;
using System.Collections.Generic;

namespace PlacementManager
{
    public partial class Geo_LocationComponent
    {
        

        /// <summary>
        /// Selects all records from the database table based on a foreign key.
        /// </summary>
        /// <returns>A collection of objects of a type representing a row in the database table.</returns>
        [DataObjectMethodAttribute(DataObjectMethodType.Select, true)]
        public List<Geo_Location> SelectAllStartingWith(string prefix, string sortExpression)
        {
            List<Geo_Location> listGeo_Location = new List<Geo_Location>();
            PlacementManager.DAL.Geo_Location_DAL o = new PlacementManager.DAL.Geo_Location_DAL();
            DataSet ds = o.SelectAllStartingWith(prefix);
            foreach (DataRow row in ds.Tables[0].Rows)
            {
                listGeo_Location.Add(new Geo_Location((int)row["GeoLocationID"], (int)row["UniqueFeatureID"], (int)row["UniqueNameID"], (double)row["Latitude"], (double)row["Longitude"], (int)row["DMS_Latitude"], (int)row["DMS_Longitude"], (string)row["UniversalTransverseMercator"], (string)row["JointOperationsGraphic"], (string)row["FeatureClassification"], (string)row["FeatureDesignation"], (string)row["CountryCode"], (int)row["CountryID"], (string)row["AdministrativeDivision"], (int)row["AdministrativeDivisionID"], (string)row["ShortName"], (string)row["SortName"], (string)row["FullName"], (DateTime)row["DateCreated"]));
            }
            listGeo_Location.Sort(new Geo_LocationComparer(sortExpression));
            return listGeo_Location;
        }

        /// <summary>
        /// Selects all records from the database table based on the AdministrativeDivisionID and a prefix.
        /// </summary>
        /// <returns>A collection of objects of a type representing a row in the database table.</returns>
        [DataObjectMethodAttribute(DataObjectMethodType.Select, true)]
        public List<Geo_Location> SelectAllWAdministrativeDivisionIDStartingWith(string prefix, int AdministrativeDivisionID, string sortExpression)
        {
            List<Geo_Location> listGeo_Location = new List<Geo_Location>();
            PlacementManager.DAL.Geo_Location_DAL o = new PlacementManager.DAL.Geo_Location_DAL();
            DataSet ds = o.SelectAllWAdministrativeDivisionIDStartingWith(prefix, AdministrativeDivisionID);
            foreach (DataRow row in ds.Tables[0].Rows)
            {
                listGeo_Location.Add(new Geo_Location((int)row["GeoLocationID"], (int)row["UniqueFeatureID"], (int)row["UniqueNameID"], (double)row["Latitude"], (double)row["Longitude"], (int)row["DMS_Latitude"], (int)row["DMS_Longitude"], (string)row["UniversalTransverseMercator"], (string)row["JointOperationsGraphic"], (string)row["FeatureClassification"], (string)row["FeatureDesignation"], (string)row["CountryCode"], (int)row["CountryID"], (string)row["AdministrativeDivision"], (int)row["AdministrativeDivisionID"], (string)row["ShortName"], (string)row["SortName"], (string)row["FullName"], (DateTime)row["DateCreated"]));
            }
            listGeo_Location.Sort(new Geo_LocationComparer(sortExpression));
            return listGeo_Location;
        }
    }
}
